#ifndef DAHENGCAMERADEVICE_H
#define DAHENGCAMERADEVICE_H

#include "device.h"

#include "GxIAPI.h"
#include "DxImageProc.h"
#include <QLabel>

class DahengCameraDevice : public Device
{
    Q_OBJECT
public:
    explicit DahengCameraDevice(QObject *parent = nullptr);
    ~DahengCameraDevice();

private:
    GX_STATUS           m_emStatus;
    GX_DEV_HANDLE       m_hDevice;
    GX_DS_HANDLE        m_hStream;              ///< 设备流句柄
    GX_FRAME_DATA       m_stFrameData;          ///< GetImage获取的图像地址

    QString             m_strIP;
    int                 m_nPort;

    int                 OpenCamera();
    int                 StartCamera();
    int                 StopCamera();
    void                writeBmpFile(char *data, int w, int h,int imageNum = 0);

public:
    static void InitLib();
    static void UninitLib();

public:
    virtual void writeXML(QXmlStreamWriter &writer) override;
    virtual void readFromXML(QXmlStreamReader &reader) override;

    virtual int initDevice() override;
    virtual void writeData(const QVariant &data) override;
    virtual void uninitDevice() override;

    virtual QString getClassName() override;
};

#endif // DAHENGCAMERADEVICE_H
